# Maintainer: Jeroen Ooms <jeroenooms@gmail.com>

_realname=redland
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.0.17
pkgrel=1
pkgdesc="Resource Description Framework (RDF) (mingw-w64)"
arch=('any')
url='http://librdf.org/'
license=('LICENSE')
source=("http://download.librdf.org/source/${_realname}-${pkgver}.tar.gz")
sha256sums=('de1847f7b59021c16bdc72abb4d8e2d9187cd6124d69156f3326dd34ee043681')

depends=("${MINGW_PACKAGE_PREFIX}-raptor2"
         "${MINGW_PACKAGE_PREFIX}-rasqal")

prepare() {
  cd $srcdir/${_realname}-${pkgver}
  > src/win32_rdf_config.h.in
}

build() {
  cd "$srcdir"/${_realname}-${pkgver}
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  CFLAGS="-DRASQAL_STATIC -DRAPTOR_STATIC" \
  RAPTOR2_LIBS=$(pkg-config --libs --static raptor2) \
  RASQAL_LIBS=$(pkg-config --libs --static rasqal) \
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --disable-debug \
    --disable-dependency-tracking \
    --disable-modular \
    --with-mysql=no \
    --with-bdb=no

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
}
